﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WP8Demos.Helpers;
using WP8Demos.Interfaces;

namespace WP8Demos.ViewModels
{
    public static class ViewModelLocator
    {
        private static MainViewModel mainViewModel = null;
        private static LockViewModel lockViewModel = null;
        private static TilesViewModel tilesViewModel = null;
        private static NotifyPropertyChangedViewModel notifyPropertyChangedViewModel = null;

        public static MainViewModel MainViewModel
        {
            get
            {
                if (mainViewModel == null)
                {
                    mainViewModel = new MainViewModel(ServiceLocator.NavigationService);
                }
                return mainViewModel;
            }
        }

        public static LockViewModel LockViewModel
        {
            get
            {
                if (lockViewModel == null)
                {
                    lockViewModel = new LockViewModel();
                }
                return lockViewModel;
            }
        }

        public static TilesViewModel TilesViewModel
        {
            get
            {
                if (tilesViewModel == null)
                {
                    tilesViewModel = new TilesViewModel();
                }
                return tilesViewModel;
            }
        }

        public static NotifyPropertyChangedViewModel NotifyPropertyChangedViewModel
        {
            get
            {
                if (notifyPropertyChangedViewModel == null)
                {
                    notifyPropertyChangedViewModel = new NotifyPropertyChangedViewModel();
                }
                return notifyPropertyChangedViewModel;
            }
        }

        private static IServiceLocator ServiceLocator
        {
            get
            {
                return App.ServiceLocator;
            }
        }
    }
}
